import Taro, { Component } from '@tarojs/taro'
import Index from './pages/index'
import { Provider, onError } from '@tarojs/mobx'
import counterStore from './store/count'
import '@tarojs/async-await'

const store = {
  counterStore
};

import './app.styl'

import './marketdown.css';

// 如果需要在 h5 环境中开启 React Devtools
// 取消以下注释：
// if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5')  {
//   require('nerv-devtools')
// }

onError(error => {
  console.log('mobx global error listener:', error);
});

class App extends Component {
  config = {
    pages: ['pages/index/index', 'pages/about/index', 'pages/detail/index'],
    window: {
      backgroundTextStyle: 'white',
      backgroundColor: '#151414',
      navigationBarBackgroundColor: '#000', //设置顶部背景
      navigationBarTitleText: 'Cnode社区', //设置小程序标题
      navigationBarTextStyle: 'light' //设置顶部标题颜色
      // enablePullDownRefresh: true //开启下拉刷新
    },
    tabBar: {
      color: '#8d8d8d',
      selectedColor: '#fee440',
      backgroundColor: '#151414',
      list: [
        {
          pagePath: 'pages/index/index',
          text: '首页',
          selectedIconPath: './static/img/yemian-active.png',
          iconPath: './static/img/yemian.png'
        },
        {
          pagePath: 'pages/about/index',
          text: '关于',
          selectedIconPath: './static/img/guanyu-active.png',
          iconPath: './static/img/guanyu.png'
        }
      ]
    }
  };

  componentDidMount() {}

  componentDidShow() {}

  componentDidHide() {}

  componentDidCatchError() {}

  // 在 App 类中的 render() 函数没有实际作用
  // 请勿修改此函数
  render() {
    return (
      <Provider store={store}>
        <Index />
      </Provider>
    );
  }
}

Taro.render(<App />, document.getElementById('app'))
